package com.dkts.oil.mysql.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

import com.dkts.oil.web.vo.request.OilStorageTankRequest;
import com.dkts.oil.web.vo.request.subReq.SqlWhere;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.geom.Point;

import static java.time.zone.ZoneRulesProvider.getRules;

/**
 * <p>
 * 
 * </p>
 *
 * @author heguanglong
 * @since 2025-04-10
 */
@Getter
@Setter
@TableName("oil_obstacle_v1")
public class OilObstacle implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 名称
     */
    @TableField("name")
    private String name;

    /**
     * 类型标签
     */
    @TableField("label")
    private Integer label;

    @TableField("geo_data")
    private String geoData;

    @TableField("create_time")
    private LocalDateTime createTime;

    /**
     * geohash值
     */
    @TableField("geo_hash")
    private String geoHash;

    /**
     * geo对应是属性值
     */
    @TableField("properties")
    private String properties;

    @TableField("point")
    private String point;

    @TableField("gps_point")
    private Point gpsPoint;

    @TableField("shape_length")
    private double shapeLength;

    @TableField("shape_area")
    private double shapeArea;

    private Geometry geometry;



    public OilObstacle(){}

    public OilObstacle(String name, Integer label, String geoData, String geoHash, String properties,Point gpsPoint, double shapeLength, double shapeArea) {
        this.name = name;
        this.label = label;
        this.geoData = geoData;
        this.geoHash = geoHash;
        this.properties = properties;
        this.gpsPoint = gpsPoint;
        this.shapeLength = shapeLength;
        this.shapeArea = shapeArea;
    }

    public OilObstacle(Integer id,String name, Integer label, String geoData, String geoHash,
                       String properties,Point gpsPoint, double shapeLength,
                       double shapeArea, Geometry geometry) {
        this.name = name;
        this.label = label;
        this.geoData = geoData;
        this.geoHash = geoHash;
        this.properties = properties;
        this.gpsPoint = gpsPoint;
        this.shapeLength = shapeLength;
        this.shapeArea = shapeArea;
        this.geometry = geometry;
        this.id=id;
    }

    public OilObstacle(String geoData, String geoHash) {
        this.geoData = geoData;
        this.geoHash = geoHash;
    }

//    public OilObstacle(String geoData, String geoHash, OilStorageTankRequest request) {
//        this.geoData = geoData;
//        this.geoHash = geoHash;
//
//       List<SqlWhere> rules = request.getRules();
//       if(rules != null){
//
////           @Schema(description  = "sql查询条件类型（label，所有障碍物，shape_length：周长，shape_area：面积  ALL：所有 ） All 所有的数据执行规则, 面积 ")
////           private String type="ALL";
////
////           @Schema(description  = "获取数据类型的数据： 4：代表所有的水域， 5：所有的：城乡、工矿、居民用地  " ,example = "1")
////           private Integer value;
////           @Schema(description  = "条件：1 大于, 2 小于 3 小于" ,example = "1")
//
////           private Integer where =2;
//
//           for (SqlWhere rule : rules) {
//               switch (rule.getType()){
//                   case "label":
//                      break;
////                   case "shape_length":
////                       break;
////                   case "shape_area":
////                       break;
//                   case "ALL":
//                       break;
//                   default:
//                       throw new RuntimeException("sql查询条件类型错误");
//               }
//           }
//       }
//    }

}
